home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 131 / XENIATGM131.iso / Shareware / openOffice.org 641 / Windows / f_0030 / DlgControl.xba < prev    next >
Extensible Markup Language  |  2001-11-16  |  6KB  |  180 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
  3. <script:module xmlns:script="http://openoffice.org/2000/script" script:name="DlgControl" script:language="StarBasic">Option Explicit
  4.  
  5. Dim CalBitmap As Object
  6. Public bSelectByMouseMove as Boolean
  7.  
  8. ' Todo: Adjustmentlistener an der Scrollbar anmelden
  9.  
  10. Sub Main()
  11.     Call CalAutopilotTable()
  12. End Sub
  13.  
  14.  
  15. Sub CalcmdDeleteSelect()
  16. Dim MsgBoxResult as Integer
  17.     If Ubound(DlgCalModel.lstOwnData.SelectedItems()) > -1 Then
  18.         MsgBoxResult = MsgBox(cCalSubcmdDeleteSelect_DeleteSelEntry$, 4+32, cCalSubcmdDeleteSelect_DeleteSelEntryTitle$)
  19.         If MsgBoxResult = 6 Then
  20.             DlgCalModel.lstOwnData.StringItemList() = RemoveSelected(DlgCalModel.lstOwnData)
  21.             ' Flag zum Speichern der neuen Daten.
  22.             bCalOwnDataChanged = True
  23.             DlgCalModel.cmdDelete.Enabled = Ubound(DlgCalModel.lstOwnData.StringItemList()) > -1
  24.             Call CalClearInputMask()
  25.         End If
  26.     End If
  27. End Sub
  28.  
  29.  
  30. Sub CalSaveOwnEventControls()
  31.     With DlgCalModel
  32.         .txtOwnEventDay.Tag = .txtOwnEventDay.Value
  33.         .txtOwnEventMonth.Tag = .txtOwnEventMonth.Text
  34.         .DlgCalModel.txtOwnEventYear.Tag = DlgCalModel.txtOwnEventYear.Value
  35.     End With
  36. End Sub
  37.  
  38.  
  39.  
  40. 'Sub ModIntTextBox (txtYear As Object, ByVal nMax%, ByVal nMin%, ByVal sDefault$, IncFactor as Integer)
  41. '    Dim nActVal&
  42. '    nActVal& = Val(txtYear.Text)
  43. '    If ((0 = nActVal&) Or (nMax% < nActVal&) Or (nMin% > nActVal&)) Then 
  44. '        Beep
  45. '        txtYear.Text = sDefault$
  46. '        Exit Sub
  47. '    End If
  48. '    If IncFactor = 1 Then
  49. '        If nMax% > nActVal& Then
  50. '            txtYear.Text = Trim(Str(nActVal& + 1))
  51. '        Else
  52. '            Beep
  53. '            txtYear.Text = nMax%
  54. '        End if
  55. '    ElseIf IncFactor = -1 Then
  56. '        If nMin% < nActVal& Then
  57. '            txtYear.Text = Trim(Str(nActVal& - 1))
  58. '        Else
  59. '            Beep
  60. '            txtYear.Text = nMin%
  61. '        End if
  62. '    End If
  63. 'End Sub
  64.  
  65.  
  66.  
  67. Sub ToggleYearBox()
  68. ' Falls der RadioButton f├╝r einen Jahreskalender angeklickt
  69. ' worden ist, m├╝ssen die Controls f├╝r den Monat Disabled
  70. ' werden, da ihre Werte in einer Jahrestabelle aufgehen.
  71.     With DlgCalModel
  72.         .txtOwnEventYear.Enabled  = .chkEventOnce.State = 1
  73.         .lblEventYear.Enabled  = .chkEventOnce.State = 1
  74.         If .txtOwnEventYear.Value = 0 And .lblEventYear.Enabled Then
  75.             .txtOwnEventYear.Value = Year(Now)
  76.         End If
  77.     End With
  78. End Sub
  79.  
  80.  
  81. Sub CalMouseMoved(aEvent as object)
  82. Dim ListIndex as Integer
  83.     Select Case sCurLangLocale
  84.         Case  cLANGUAGE_GERMAN
  85.             If bSelectByMouseMove Then
  86. '                oStatusLine.SetText(aEvent.X & " ; " & aEvent.Y)
  87.                 ListIndex = CalGetGermanLandAtMousePos(aEvent.X, aEvent.Y, Land$)
  88.                 DlgCalendar.GetControl("lstHolidays").SelectItemPos(ListIndex, True)
  89.             End If
  90.     End Select    
  91. End Sub
  92.  
  93.  
  94. Sub SelectState(aEvent as Object)
  95. Dim ListIndex as Integer
  96.     If aEvent.ClickCount >= 1 Then
  97.         ListIndex = CalGetGermanLandAtMousePos(aEvent.X, aEvent.Y, Land$)
  98.         DlgCalendar.GetControl("lstHolidays").SelectItemPos(ListIndex, True)
  99.         bSelectByMouseMove = False
  100.     End If
  101. End Sub
  102.  
  103. Sub MouseLeavesImage
  104.     bSelectbyMouseMove = True
  105. End Sub
  106.  
  107.  
  108. Sub CalClearInputMask()
  109. Dim NullList() as String
  110. '  L├╢scht die Werte der Eingabe Controls f├╝r ein neues Ereignis.
  111.     With DlgCalModel
  112.         .chkEventOnce.State = 0
  113.         .lblEventYear.Enabled = False
  114.         .txtOwnEventYear.Enabled = False
  115.         .txtOwnEventYear.SetPropertyToDefault("Value")
  116.         .txtEvent.Text = ""
  117.         .txtOwnEventDay.SetPropertyToDefault("Value")
  118.         .cmdInsert.Enabled = False
  119. ' Todo: Wie kriegt man den Focus auf dieses  verdammte Control?        
  120. '        .txtEvent.DefaultButton = True
  121.     End With
  122.     DlgCalendar.GetControl("lstOwnEventMonth").SelectItemPos(0,True)
  123.     CurOwnMonth = 1
  124. End Sub
  125.  
  126.  
  127. Sub CalmdSwitchOwnDataOrGeneral()
  128.     '├ändert den Titel der Dialogbox beim Seitenwechsel und die 
  129.     'Beschriftungen der Kn├╢pfe
  130.     If DlgCalModel.Step = 1 Then
  131.         DlgCalModel.Step = 2
  132.         DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_Back$
  133.         DlgCalModel.cmdInsert.Enabled = DlgCalModel.txtEvent.Text <> ""
  134.         ToggleYearBox()
  135.     Else
  136.         DlgCalModel.Step = 1
  137.         DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
  138.     End If
  139. End Sub
  140.  
  141.  
  142. Sub ToggleInsertButton()
  143.     DlgCalModel.cmdInsert.Enabled = LTrim(DlgCalModel.txtEvent.Text) <> ""    
  144. End Sub
  145.  
  146.  
  147. Sub CalUpdateNewEventFrame()
  148. Dim bDoEnable as Boolean
  149. Dim sSelectedItem
  150. Dim ListIndex as Integer
  151. Dim MaxSelIndex as Integer
  152. Dim iMonth as Integer
  153.     bDoEnable = False
  154.     With DlgCalModel
  155.         MaxSelIndex = Ubound(DlgCalModel.lstOwnData.SelectedItems())
  156.         If MaxSelIndex > -1 Then
  157.             ListIndex = .lstOwnData.SelectedItems(MaxSelIndex)
  158.             .txtEvent.Text = CalGetNameofEvent(ListIndex)
  159.             .txtOwnEventDay.Value = CalGetDayOfEvent(ListIndex)
  160.             iMonth = CalGetMonthOfEvent(ListIndex)
  161.             DlgCalendar.GetControl("lstOwnEventMonth").SelectItemPos(iMonth-1, True)
  162.             CurOwnMonth = DlgCalModel.lstOwnEventMonth.SelectedItems(0) + 1
  163.             If CalGetYearofEvent(ListIndex) <> 0 Then
  164.                 .txtOwnEventYear.Value = CalGetYearofEvent(ListIndex)
  165.                 bDoEnable = True
  166.             Else
  167.                 bDoEnable = False
  168.                 DlgCalModel.txtOwnEventYear.SetPropertyToDefault("Value")
  169.             End If
  170.             .chkEventOnce.State = Abs(bDoEnable)
  171.             .lblEventYear.Enabled = bDoEnable
  172.             .txtOwnEventYear.Enabled = bDoEnable
  173.             .cmdDelete.Enabled = True
  174.             .cmdInsert.Enabled = True
  175.         Else
  176.             Call CalClearInputMask()
  177.             .cmdDelete.Enabled = False
  178.         End If
  179.     End With
  180. End Sub</script:module>